<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>


    // 检测数据类型3 
    // 　因为toString是Object的原型方法, 而 Array Function 等都是Object的实例。都重写了toString 方法。返回的是类型的字符串
    // Object.prototype.toString.call();
    var obj = {}
    console.log(obj)
    console.log(Object.prototype.toString.call("sdfasfd")) //[object String]
    console.log(Object.prototype.toString.call(null))//[object Null]
    // Object.prototype.toString.call(true)-- -> [object Boolean]
    // Object.prototype.toString.call(function () { })-- -> [object Function]
    // Objdec.prototype.toString.call(new Date)-- -> [object Date]
    // 检测数据类型4  每个对象都有构造器 constructor
    console.log([1, 2, 3].constructor === Array)
    var num = 888;
    console.log(num.constructor === Number)

  </script>
</body>

</html>